"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lifecycle = void 0;
const log_1 = require("ee-core/log");
const config_1 = require("ee-core/config");
const electron_1 = require("ee-core/electron");
class Lifecycle {
    /**
     * Core app has been loaded
     */
    ready() {
        return __awaiter(this, void 0, void 0, function* () {
            log_1.logger.info('[lifecycle] ready');
        });
    }
    /**
     * Electron app is ready
     */
    electronAppReady() {
        return __awaiter(this, void 0, void 0, function* () {
            log_1.logger.info('[lifecycle] electron-app-ready');
        });
    }
    /**
     * Main window has been loaded
     */
    windowReady() {
        return __awaiter(this, void 0, void 0, function* () {
            log_1.logger.info('[lifecycle] window-ready');
            // Delay loading, no white screen
            const config = (0, config_1.getConfig)();
            const { windowsOption } = config;
            if ((windowsOption === null || windowsOption === void 0 ? void 0 : windowsOption.show) === false) {
                const win = (0, electron_1.getMainWindow)();
                win.once('ready-to-show', () => {
                    win.show();
                    win.focus();
                });
            }
        });
    }
    /**
     * Before app close
     */
    beforeClose() {
        return __awaiter(this, void 0, void 0, function* () {
            log_1.logger.info('[lifecycle] before-close');
        });
    }
}
exports.Lifecycle = Lifecycle;
Lifecycle.toString = () => '[class Lifecycle]';
